﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="PageBasePage.aspx.cs" Inherits="TestWebSite.UI.PageBasePage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContentTitle" runat="server">
    UI.PageBase
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <fieldset>
        <legend>Methods</legend>
        <dl>
            <dt>GetFromViewState&lt;T&gt;</dt>
            <dd>
                Gets a strongly typed value from ViewState (specifying only the name).<br />
                If there's no value set with the specified name, it returns the default value for the specified type.    
            </dd>
            
            <dt>SetToViewState&lt;T&gt;</dt>
            <dd>Sets a strongly typed value to ViewState.</dd>

            <dt>GetFromSession&lt;T&gt;</dt>
            <dd>
                Gets a strongly typed value from Session (specifying only the name).<br />
                If there's no value set with the specified name, it returns the default value for the specified type.    
            </dd>
            
            <dt>SetToSession&lt;T&gt;</dt>
            <dd>Sets a strongly typed value to Session.</dd>

            <dt>SetAuthenticatedUserCookieAndRedirectToDefaultPage</dt>
            <dd>Stores a cookie for the authenticated user specified.</dd>
            
            <dt>RedirectsToLoginPage</dt>
            <dd>Redirects to Login page, keeping the existing QueryString and adding extra values to it.</dd>

            <dt>ShowMessage</dt>
            <dd>Shows a message in the specified Label Control.</dd>

            <dt>ClearMessage</dt>
            <dd>Clears the message from the specified Label Control.</dd>

            <dt>ShowFileDownloadDialog</dt>
            <dd>Shows a file download dialog for the specified file.</dd>
        </dl>
    </fieldset>
    
    <br />
    
    <fieldset>
        <legend>GetFromViewState & SetToViewState</legend>
        (Test it by Debugging this page)<br />
        <br />

        <asp:Button runat="server" ID="btnSetViewStateValues" Text="Set values in ViewState" OnClick="btnSetViewStateValues_Click" />
    </fieldset>

    <fieldset>
        <legend>GetFromSession & SetToSession</legend>
        (Test it by Debugging this page)<br />
        <br />

        <asp:Button runat="server" ID="btnSetSessionValues" Text="Set values in Session" OnClick="btnSetSessionValues_Click"/>
    </fieldset>

    <fieldset>
        <legend>SetAuthenticatedUserCookieAndRedirectToDefaultPage</legend>

        Username: <asp:TextBox runat="server" ID="txtUserName" ValidationGroup="AuthenticateAndRedirectToDefault" />&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtUserName" ValidationGroup="AuthenticateAndRedirectToDefault" ErrorMessage="Required" CssClass="failureNotification" /><br />
        <asp:Button runat="server" ID="btnAuthenticatedUser" Text="Authenticate user and redirect to default page" ValidationGroup="AuthenticateAndRedirectToDefault" OnClick="btnAuthenticatedUser_Click" />
    </fieldset>

    <fieldset>
        <legend>RedirectsToLoginPage</legend>

        Extra QueryString: <asp:TextBox runat="server" ID="txtRedirectToLoginPage" /><br />
        <asp:Button runat="server" ID="btnRedirectToLoginPage" Text="Redirects to login page" OnClick="btnRedirectToLoginPage_Click" /><br />
    </fieldset>

    <fieldset>
        <legend>ShowMessage & ClearMessage</legend>

        Message to show: <asp:TextBox runat="server" ID="txtMessageToShow" ValidationGroup="Messages" />&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtMessageToShow" ValidationGroup="Messages" ErrorMessage="Required" CssClass="failureNotification" /><br />
        <asp:Button runat="server" ID="btnShowMessage" Text="Show message" ValidationGroup="Messages" OnClick="btnShowMessage_Click" />
        <asp:Button runat="server" ID="btnClearMessage" Text="Clear message" OnClick="btnClearMessage_Click" />
        <p><asp:Label runat="server" ID="lblMessageToShow" /></p>
    </fieldset>

    <fieldset>
        <legend>ShowFileDownloadDialog</legend>

        <asp:FileUpload runat="server" ID="fupArchivo" />&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="fupArchivo" ValidationGroup="DownloadFile" ErrorMessage="Required" CssClass="failureNotification" /><br />
        <asp:Button runat="server" ID="btnDownload" Text="Download file" ValidationGroup="DownloadFile" OnClick="btnDownload_Click" />
    </fieldset>
</asp:Content>
